<template>
	<view class="content">
		<text style="font-size: 50rpx;">子组件A</text>
		<view class="coma_box">
			<text>父组件传进来的值：</text>
			<text style="font-weight: bold; color: red;">{{ intent }}</text>
		</view>
		<button type="primary" @click="sendData()" style="margin-top: 20rpx;">传值给CompB组件</button>
	</view>
</template>

<script>
	export default {
		props: ['intent'],
		name: "compA",
		data() {
			return {

			};
		},
		created() {
			console.log("created comA");
		},
		mounted() {
			console.log("mounted comA");
		},
		methods: {
			sendData() {
				console.log('子组件A传值给B：', this.intent);
				uni.$emit('getIntent', this.intent);
			}
		}
	}
</script>

<style>
	.content {
		background-color: #f0a9b7;
		display: flex;
		flex-direction: column;
		align-items: center;
		height: 300rpx;
		margin: 50rpx;
	}

	.coma_box {
		font-size: 28rpx;
		flex-direction: row;
		align-items: flex-start;
		width: 100%;
	}

	button {
		margin: 50rpx;
	}
</style>